cmake_minimum_required(VERSION 3.10)

# 项目配置
project(gateway LANGUAGES CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)

set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")

# 设置目标系统（可选）
# set(CMAKE_SYSTEM_NAME Linux)

# 宏定义管理
add_definitions(-DDEBUG) # 调试模式
add_definitions(-DTEST) # 开启单测

# 目录配置
set(LIBS_DIR ${CMAKE_SOURCE_DIR}/libs)
set(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
set(SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)

# 添加头文件搜索路径
include_directories(include)
include_directories(include/common)
include_directories(include/core)
include_directories(include/modules)
include_directories(include/utils)
include_directories(libs/inic)

# 添加库文件
# add_subdirectory(${LIBS_DIR}/inic)

# 排除示例文件
list(FILTER SOURCES EXCLUDE REGEX "/examples/")

# 源文件目录
file(GLOB_RECURSE SOURCES "src/*.cpp")

# 程序文件
add_executable(gateway.exe ${SOURCES}
        src/core/logger.cpp)

target_link_libraries(gateway.exe PUBLIC pthread)

# 添加第三方库（需提前find_package）
# find_package(SomeLib REQUIRED)
# target_link_libraries(agw_server SomeLib::some_target)

# 创建日志目录
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/logs)

# 复制配置文件
file(COPY ${CMAKE_SOURCE_DIR}/etc DESTINATION ${CMAKE_BINARY_DIR})
